﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MedicalCare.Utilities;

namespace MedicalCare.Validation
{
    public class PreValidator : APreValidator
    {
       // protected List<string> ValidationResults;

        //protected AMessage IsValidId(string idIn, string idOut)
        //{
        //    var msg = new Message(true, "");
        //    if (string.IsNullOrEmpty(idOut))
        //    {
        //        msg.FlagError(ErrorTypes.VALIDATIONERROR.ToString(), "Cannot find ID " + idIn);
        //    }
        //    return msg;
        //}


        public override AMessage IsNullOrEmpty(string name, string value)
        {
            var msg = new Message(true, string.Empty);
            if (string.IsNullOrEmpty(value))
            {
                msg.Success = false;
                msg.ErrorType = ErrorTypes.VALIDATIONERROR.ToString();
                msg.Description = name + " cannot be null or empty.";
            }
            return msg;
        }


        public override AMessage IsLessThanOrEqualToZero(string name, int value)
        {
            var msg = new Message(true, string.Empty);
            if (value <= 0)
            {
                msg.Success = false;
                msg.ErrorType = ErrorTypes.VALIDATIONERROR.ToString();
                msg.Description = name + " cannot be zero.";
            }
            return msg;
        }

        protected AMessage IsLessThanOrEqualToZero(string name, decimal value)
        {
            var msg = new Message(true, string.Empty);
            if (value <= 0)
            {
                msg.Success = false;
                msg.ErrorType = ErrorTypes.VALIDATIONERROR.ToString();
                msg.Description = name + " cannot be zero.";
            }
            return msg;
        }
    }
}
